﻿Public Class DataFactory
    Private Shared _SerialData As SerialData
    Private Shared _UsuarioData As UsuarioData
    Private Shared _PermisoData As PermisoData
    Private Shared _RolData As RolData

    Private Shared ReadOnly PadLock As New Object()
    Private Shared _instance As DataFactory

    Public Shared ReadOnly Property Instance() As DataFactory
        Get
            SyncLock PadLock
                If _instance Is Nothing Then
                    _instance = New DataFactory
                End If
                Return _instance
            End SyncLock
        End Get
    End Property

    Public Shared ReadOnly Property Serial() As SerialData
        Get
            If (DataFactory._SerialData Is Nothing) Then
                DataFactory._SerialData = New SerialData
            End If
            Return DataFactory._SerialData
        End Get
    End Property

    Public Shared ReadOnly Property Usuario() As UsuarioData
        Get
            If (DataFactory._UsuarioData Is Nothing) Then
                DataFactory._UsuarioData = New UsuarioData
            End If
            Return DataFactory._UsuarioData
        End Get
    End Property

    Public Shared ReadOnly Property Permiso() As PermisoData
        Get
            If (DataFactory._PermisoData Is Nothing) Then
                DataFactory._PermisoData = New PermisoData
            End If
            Return DataFactory._PermisoData
        End Get
    End Property

    Public Shared ReadOnly Property Rol() As RolData
        Get
            If (DataFactory._RolData Is Nothing) Then
                DataFactory._RolData = New RolData
            End If
            Return DataFactory._RolData
        End Get
    End Property

End Class
